import re
html = '''
<div>
    <div class="name">
        <span>张三</span>
    </div>
    <div class="age">
        <span>19</span>
    </div>
    <div class="class">
        <span>三年级</span>
    </div>
    <div class="score">
        <span>90</span>
    </div>
</div>
'''

rgex = re.compile(r'<div class="(?P<clz>.*?)">.*?<span>(?P<content>.*?)</span>', re.S)
it = rgex.finditer(html)
for item in it:
    print(item.group('clz'))
    print(item.group('content'))
